Pass event instead of value to Input's onChange callback#692
Pass event instead of value to Input's onChange callback#692arzke wants to merge 1 commit intoElemeFE:masterfrom
Conversation
|
|
||
| it('onChange', (done) => { | ||
| const updateValue = function(event) { | ||
| expect(event.target).toBeInstanceOf(EventTarget); |
There was a problem hiding this comment.
I know that this is not perfect, but as SyntheticEvent is not a constructor, just a type, and that I don't really get an Event, I needed a way to make sure I was getting a SyntheticEvent rather than a string. Events have a target, so I didn't want to check on every single property. Any suggestion is welcome if you have a better idea.
There was a problem hiding this comment.
Personally, I think it would be better that passing the event than the string. However this will change the API and other users will need to update their old code.
There was a problem hiding this comment.
Sorry for the lazy response, passing the value string is an easy way to devs, I think we can pass additional parameter as SyntheticEvent type.
If we change the first parameter to SyntheticEvent, the other components which relies on Input need rework to make sure onChange event works.
|
Please do this, users who has already done their app can stay on an old release no ? |
|
This change will cause unexpected behavior since My solution is giving additional parameter as the native event, as |
Please makes sure these boxes are checked before submitting your PR, thank you!
masterbranch.npm test,npm run lintandnpm run build.Changes in this pull request